import csv

class Student:
    def __init__(self,no,name,age,major):
        self.no = no
        self.name = name
        self.age = age
        self.major = major

    def __str__(self):
        return f"no: '{self.no}', name: '{self.name}', age: {self.age}, major: '{self.major}'}}"

stus = []

with open('stu.csv','r',encoding='utf-8') as f:
    reader = csv.DictReader(f)
    for d in reader:
        s = Student(d['学号'],d['姓名'],d['年龄'],d['专业'])
        stus.append(s)
for stu in stus:
    print(stu)


